@@ -3,14 +3,10 @@ |
||
| 3 | 3 |
<component name="ProjectModuleManager"> |
| 4 | 4 |
<modules> |
| 5 | 5 |
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
| 6 |
- <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
|
| 7 |
- <module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" /> |
|
| 8 | 6 |
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" /> |
| 9 | 7 |
<module fileurl="file://$PROJECT_DIR$/lensman.iml" filepath="$PROJECT_DIR$/lensman.iml" /> |
| 10 |
- <module fileurl="file://$PROJECT_DIR$/lensman.iml" filepath="$PROJECT_DIR$/lensman.iml" /> |
|
| 11 | 8 |
<module fileurl="file://$PROJECT_DIR$/lensman_ssh.iml" filepath="$PROJECT_DIR$/lensman_ssh.iml" /> |
| 12 | 9 |
<module fileurl="file://$PROJECT_DIR$/views/views.iml" filepath="$PROJECT_DIR$/views/views.iml" /> |
| 13 |
- <module fileurl="file://$PROJECT_DIR$/views/views.iml" filepath="$PROJECT_DIR$/views/views.iml" /> |
|
| 14 | 10 |
</modules> |
| 15 | 11 |
</component> |
| 16 | 12 |
</project> |
@@ -11,6 +11,7 @@ import android.widget.TextView; |
||
| 11 | 11 |
import android.widget.Toast; |
| 12 | 12 |
|
| 13 | 13 |
import com.android.common.utils.LogHelper; |
| 14 |
+import com.android.common.utils.NetworkUtil; |
|
| 14 | 15 |
import com.umeng.analytics.MobclickAgent; |
| 15 | 16 |
|
| 16 | 17 |
import java.util.ArrayList; |
@@ -84,13 +85,13 @@ public class MainActivity extends BaseActivity implements MainContract.View {
|
||
| 84 | 85 |
|
| 85 | 86 |
@Override |
| 86 | 87 |
public void showBoxDisconnectedView() {
|
| 87 |
- boxStatusTextView.setText(R.string.bt_disconnected); |
|
| 88 |
+ boxStatusTextView.setText(NetworkUtil.getWIFIName(this)); |
|
| 88 | 89 |
boxStatusImageView.setImageResource(R.drawable.wifi_disconnect); |
| 89 | 90 |
} |
| 90 | 91 |
|
| 91 | 92 |
@Override |
| 92 | 93 |
public void showBoxConnectedView() {
|
| 93 |
- boxStatusTextView.setText(R.string.bt_connected); |
|
| 94 |
+ boxStatusTextView.setText(NetworkUtil.getWIFIName(this)); |
|
| 94 | 95 |
boxStatusImageView.setImageResource(R.drawable.wifi_connect); |
| 95 | 96 |
} |
| 96 | 97 |
|
@@ -4,6 +4,9 @@ package com.android.common.utils; |
||
| 4 | 4 |
import android.content.Context; |
| 5 | 5 |
import android.net.ConnectivityManager; |
| 6 | 6 |
import android.net.NetworkInfo; |
| 7 |
+import android.net.wifi.SupplicantState; |
|
| 8 |
+import android.net.wifi.WifiInfo; |
|
| 9 |
+import android.net.wifi.WifiManager; |
|
| 7 | 10 |
|
| 8 | 11 |
/** |
| 9 | 12 |
* 网络相关工具类 |
@@ -67,4 +70,18 @@ public class NetworkUtil {
|
||
| 67 | 70 |
} |
| 68 | 71 |
return 0; |
| 69 | 72 |
} |
| 73 |
+ |
|
| 74 |
+ public static String getWIFIName(Context context){
|
|
| 75 |
+ String ssid = "未知网络"; |
|
| 76 |
+ try {
|
|
| 77 |
+ WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); |
|
| 78 |
+ WifiInfo wifiInfo = wifiManager.getConnectionInfo(); |
|
| 79 |
+ if (wifiInfo.getSupplicantState() == SupplicantState.COMPLETED) {
|
|
| 80 |
+ ssid = wifiInfo.getSSID(); |
|
| 81 |
+ } |
|
| 82 |
+ }catch (Exception e){
|
|
| 83 |
+ e.printStackTrace(); |
|
| 84 |
+ } |
|
| 85 |
+ return ssid; |
|
| 86 |
+ } |
|
| 70 | 87 |
} |